package com.fqcar.fqdf.ui.main.marker;

import android.os.Bundle;

import com.baidu.mapapi.map.BitmapDescriptor;
import com.baidu.mapapi.map.MarkerOptions;
import com.baidu.mapapi.map.OverlayOptions;
import com.baidu.mapapi.model.LatLng;

/**
 * @author lvsidong
 * @version V1.0
 * @date 2017/7/25
 * @desc 百度地图的marker添加帮助类
 */
public class BaiduMarkerHelper extends BaseMarkerHelper<OverlayOptions, BitmapDescriptor> {

    public OverlayOptions createOverlay(BitmapDescriptor bitmapDescriptor, LatLng latLng) {
        return createOverlay(bitmapDescriptor, latLng.latitude, latLng.longitude,null);
    }

    public OverlayOptions
    createOverlay(BitmapDescriptor bitmapDescriptor, LatLng latLng, Bundle bundle) {
        return createOverlay(bitmapDescriptor, latLng.latitude, latLng.longitude,bundle);
    }

    @Override
    public OverlayOptions createOverlay(BitmapDescriptor bitmapDescriptor, double latitude, double longitude) {

        return createOverlay(bitmapDescriptor, latitude, longitude, null);
    }

    @Override
    public OverlayOptions createOverlay(BitmapDescriptor bitmapDescriptor, double latitude, double longitude, Bundle bundle) {
        MarkerOptions option = new MarkerOptions();

        if (bitmapDescriptor != null) {
            option.icon(bitmapDescriptor);
        }
        option.position(new LatLng(latitude, longitude));

        option.anchor(0.5f,0.78f);

        if (bundle != null) {
            option.extraInfo(bundle);
        }

        return option;
    }

}
